#!/bin/bash
f=/home/`whoami`/tf
g=/home/`whoami`/tf/tlog.txt
if [ -d $f ]
then
   echo "the backup file--tf exists"
else
   mkdir $f
   touch $g
   echo "created backup file--tf file"
fi
if [ -f $1 -o -d $1 ]
then
   echo "the source file exists"
   s=`cat $g|grep $1`
   if [ -n "$s" ]
   then
   echo "the source file has been backed up"
   exit 0
   fi
else
   echo "the source file does not exit"
   exit 0
fi
tar -czvf $1.tar.gz $1>/dev/null 2>&1
t=`date +%-d-%-m-%Y_%T`
mv $1.tar.gz $1-$t.tar.gz
mv $1-$t.tar.gz $f
echo "name:$1-$t.tar.gz">>$g
echo "source file:$1">>$g
echo "tarfilem file:$f">>$g
echo "create tiem:$t">>$g
echo "******************************">>$g
echo "complete operation"
